package news.yp.newsproject.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.EditText;
import android.widget.TextView;

import com.daimajia.slider.library.Animations.DescriptionAnimation;
import com.daimajia.slider.library.SliderLayout;
import com.daimajia.slider.library.SliderTypes.BaseSliderView;
import com.daimajia.slider.library.SliderTypes.TextSliderView;
import com.daimajia.slider.library.Tricks.ViewPagerEx;
import com.news.yp.baselibrary.annotation.ViewById;
import com.news.yp.baselibrary.base.BaseActivityPresenter;

import java.util.List;

import news.yp.newsproject.R;
import news.yp.newsproject.bean.RequestDetailData;
import news.yp.newsproject.bean.ResponseDetailData;
import news.yp.newsproject.presenter.presenter.CenterPresenter;
import news.yp.newsproject.presenter.presenter.DetailPresenter;

public class ShowDetailActivity extends BaseActivityPresenter<DetailPresenter> implements CenterPresenter.DetailViewPresenter {
    @ViewById(R.id.detail_text)
    private EditText textView;
    @ViewById(R.id.slider)
    private SliderLayout mslider;
    @ViewById(R.id.title_center)
    private TextView mtitle;
    @ViewById(R.id.detail_date)
    private TextView detailText;

    @Override
    public void onLoading() {

        //   loadtextView.setText("马上就来");
    }

    @Override
    public void onError() {
    }

    @Override
    public void onDetailSuccess(ResponseDetailData responseDetailData) {
        // loadtextView.setVisibility(View.INVISIBLE);
        initPic(responseDetailData.getData());
        String content = "";
        mtitle.setText(responseDetailData.getData().getTitle());
        Log.e("TAG", "-----文章内容：" + content);
        textView.setText(responseDetailData.getData().getContent());
    }

    private void initPic(ResponseDetailData.DataBean mDataBean) {
    }

    @Override
    protected DetailPresenter createPresenter() {
        return new DetailPresenter();
    }

    @Override
    protected void setContentView() {
        setContentView(R.layout.detail_layout);
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initTitle() {

    }

    @Override
    protected void initData() {
        Intent intent = getIntent();
        String section = intent.getStringExtra("page");
        String id = intent.getStringExtra("id");
        RequestDetailData requestDetailData = new RequestDetailData();
        requestDetailData.setSection(section);
        requestDetailData.setId(id);
        getPresenter().getDetailData(requestDetailData);
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        Log.e("TAG", "你点击了回退");
        finish();
    }
}
